package com.telenav.app;

import com.telenav.comm.Comm;
import com.telenav.comm.HostProvider;
import com.telenav.network.NetworkManager;

public class CommManager
{  
    private static CommManager commManager = new CommManager();
    
    protected Comm mComm;
    
    protected HostProvider hosts;
    
    public CommManager()
    {
    	hosts = new HostProvider();
    }
    
    public static CommManager getInstance()
    {
        return commManager;
    }
    
    public Comm getComm()
    {
        if (this.mComm == null)
        {
			this.mComm = new Comm(NetworkManager.getInstance(),
					ThreadManager.getPool(ThreadManager.TYPE_COMM_REQUEST));
			this.mComm.setHostProvider(this.hosts);
        }

        return this.mComm;
    }
    
    public void initializeHosts()
    {
    	this.hosts.setServerConfig();
    }
}
